const express = require('express');
const router = express.Router();
const pool = require('../pool');

router.post('/query_vip', (req, res, next) => {
  pool.query(
    `select * from inforecord where carnum = (SELECT usercarid FROM login WHERE username = ?);
  SELECT balance FROM login WHERE username = ?;
  SELECT * FROM login WHERE username = ?;`,
    [req.body.username, req.body.username, req.body.username],
    (err, result) => {
      if (err) return next(err);
      if (result.length == 0) {
        res.send({
          code: 400,
          msg: '未找到信息',
        });
      } else {
        res.send({
          code: 200,
          msg: 'success',
          data: result,
        });
      }
    }
  );
});
module.exports = router;
